package com.dankegongyu.component.jsbridge.config;

import androidx.annotation.ColorRes;
import androidx.annotation.DrawableRes;
import androidx.annotation.IntRange;
import androidx.annotation.Keep;

import com.dankegongyu.component.jsbridge.R;
import com.dankegongyu.component.jsbridge.bean.DKWebStatusbarBean;

import java.io.Serializable;

/**
 * Created by Admin on 2018/3/31.
 */
@Keep
public class DKWebToolbarConfig implements Serializable {

    @DKWebStatusbarBean
    private int statusbarMode;
    @ColorRes
    private int statusbarColor;
    @IntRange(from = 0, to = 255)
    private int statusbarAlpha;

    private boolean toolbarVisible;
    @ColorRes
    private int toolbarColorRes;

    private boolean backBtnVisible;
    @DrawableRes
    private int backBtnRes;

    private boolean closeBtnVisible;
    @DrawableRes
    private int closeBtnRes;

    private String title;
    @ColorRes
    private int titleColor;
    private int titleSize;

    private boolean bottomLineVisible;
    @DrawableRes
    private int bottomLineDrawableRes;

    private int menuRes;

    private DKWebToolbarConfig(Builder builder) {

        this.statusbarMode = builder.statusbarMode;
        this.statusbarColor = builder.statusbarColor;
        this.statusbarAlpha = builder.statusbarAlpha;
        this.toolbarVisible = builder.toolbarVisible;
        this.toolbarColorRes = builder.toolbarColorRes;
        this.backBtnVisible = builder.backBtnVisible;
        this.backBtnRes = builder.backBtnRes;
        this.closeBtnVisible = builder.closeBtnVisible;
        this.closeBtnRes = builder.closeBtnRes;
        this.title = builder.title;
        this.titleColor = builder.titleColor;
        this.titleSize = builder.titleSize;
        this.bottomLineVisible = builder.bottomLineVisible;
        this.bottomLineDrawableRes = builder.bottomLineDrawableRes;
        this.menuRes = builder.menuRes;

    }

    public int getStatusbarMode() {
        return statusbarMode;
    }

    public int getStatusbarColor() {
        return statusbarColor;
    }

    public int getStatusbarAlpha() {
        return statusbarAlpha;
    }

    public boolean isToolbarVisible() {
        return toolbarVisible;
    }

    public int getToolbarColorRes() {
        return toolbarColorRes;
    }

    public boolean isBackBtnVisible() {
        return backBtnVisible;
    }

    public int getBackBtnRes() {
        return backBtnRes;
    }

    public boolean isCloseBtnVisible() {
        return closeBtnVisible;
    }

    public int getCloseBtnRes() {
        return closeBtnRes;
    }

    public String getTitle() {
        return title;
    }

    public @ColorRes
    int getTitleColor() {
        return titleColor;
    }

    public int getTitleSize() {
        return titleSize;
    }

    public boolean isBottomLineVisible() {
        return bottomLineVisible;
    }

    public int getMenuRes() {
        return menuRes;
    }

    public int getBottomLineDrawableRes() {
        return bottomLineDrawableRes;
    }

    public static class Builder {
        @DKWebStatusbarBean
        private int statusbarMode;
        @ColorRes
        private int statusbarColor = R.color.jbp_white;
        @IntRange(from = 0, to = 255)
        private int statusbarAlpha = 0;

        private boolean toolbarVisible = true;
        @ColorRes
        private int toolbarColorRes = R.color.jbp_white;

        private boolean backBtnVisible = true;
        @DrawableRes
        private int backBtnRes;

        private boolean closeBtnVisible = true;
        @DrawableRes
        private int closeBtnRes;

        private String title;
        @ColorRes
        private int titleColor = R.color.jbp_color_333;
        private int titleSize = 20;

        private boolean bottomLineVisible = false;

        @DrawableRes
        private int bottomLineDrawableRes;

        private int menuRes;

        public Builder() {
        }

        public DKWebToolbarConfig builder() {
            return new DKWebToolbarConfig(this);
        }


        public Builder setStatusbarMode(@DKWebStatusbarBean int statusbarMode) {
            this.statusbarMode = statusbarMode;
            return this;
        }

        public Builder setStatusbarColor(@ColorRes int statusbarColor) {
            this.statusbarColor = statusbarColor;
            return this;
        }

        public Builder setStatusbarAlpha(@IntRange(from = 0, to = 255) int statusbarAlpha) {
            this.statusbarAlpha = statusbarAlpha;
            return this;
        }


        public Builder setToolbarVisible(boolean toolbarVisible) {
            this.toolbarVisible = toolbarVisible;
            return this;
        }

        public Builder setToolbarColorRes(@ColorRes int colorRes) {
            this.toolbarColorRes = colorRes;
            return this;
        }


        public Builder setBackBtnVisible(boolean isVisible) {
            this.backBtnVisible = isVisible;
            return this;
        }

        public Builder setBackBtnRes(@DrawableRes int backBtnRes) {
            this.backBtnRes = backBtnRes;
            return this;
        }

        public Builder setCloseBtnVisible(boolean isVisible) {
            this.closeBtnVisible = isVisible;
            return this;
        }

        public Builder setCloseBtnRes(@DrawableRes int closeBtnRes) {
            this.closeBtnRes = closeBtnRes;
            return this;
        }


        public Builder setTitle(String title) {
            this.title = title;
            return this;
        }

        public Builder setTitleColor(@ColorRes int titleColor) {
            this.titleColor = titleColor;
            return this;
        }

        // 单位dp
        public Builder setTitleSize(int titleSize) {
            this.titleSize = titleSize;
            return this;
        }

        // 底部分割线是否显示
        public Builder setBottomLineVisible(boolean bottomLineVisible) {
            this.bottomLineVisible = bottomLineVisible;
            return this;
        }

        // 底部分割线资源
        public Builder setBottomLineDrawableRes(@DrawableRes int bottomLineDrawableRes) {
            this.bottomLineDrawableRes = bottomLineDrawableRes;
            return this;
        }

        public Builder setMenuRes(int menuRes) {
            this.menuRes = menuRes;
            return this;
        }

    }

}
